package com.ruijixiang.leetcode.weekly.leetcode2024.leetcode20240908;

public class leetcode3280 {
    public String convertDateToBinary(String date){
        String[] strs=date.split("-");
        int year=Integer.parseInt(strs[0]);
        int month=Integer.parseInt(strs[1]);
        int day=Integer.parseInt(strs[2]);
        return change(year)+"-"+change(month)+"-"+change(day);
    }

    private String change(int num){
        StringBuilder sb=new StringBuilder();
        while(num!=0){
            sb.append(num%2);
            num=num/2;
        }
        return sb.reverse().toString();
    }
}
